var t = function(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}(require("../../utils/api2")), i = void 0;

Component({
    externalClasses: [ "navtop-exter" ],
    properties: {
        navigation: {
            type: "Object",
            value: {}
        },
        mode: {
            type: "String",
            value: "view",
            observer: function(t) {
                this.setData({
                    mode: t || "view"
                });
            }
        }
    },
    data: {
        navigation: {
            status: !1,
            isfocus: !1,
            navs: [],
            site: {}
        },
        mode: "view",
        isInWeChat: !0
    },
    ready: function() {
        var t = getCurrentPages();
        i = t[t.length - 1];
        var a = "wx" === getApp().globalData.environment;
        this.setData({
            isInWeChat: a
        });
    },
    methods: {
        toggleSidebar: function(t) {
            var a = t.currentTarget.dataset.status, e = this.properties.navigation.site.style.nav;
            this.sidebarAnimation = this.sidebarAnimation || wx.createAnimation({
                duration: 200,
                timingFunction: "linear"
            }), 3 !== e ? this.sidebarAnimation.top(a ? "-652rpx" : "98rpx").step() : this.sidebarAnimation.right(a ? "-70vw" : "0").step(), 
            this.setData({
                "navigation.animationData": this.sidebarAnimation.export(),
                "navigation.status": !a
            }), i.setData({
                "sidebar.status": !a
            });
        },
        navigateToSiteIndex: function() {
            var t = this.data.navigation.site.sid;
            wx.redirectTo({
                url: "/pages/website/index/index?sid=" + t
            });
        },
        setSiteFocus: function(a) {
            var e = this, s = this.data.navigation.site.sid, n = a.currentTarget.dataset.isfocus, o = n ? "cancel" : "add";
            t.default.site.focus.set({
                data: {
                    sid: s,
                    op: o
                },
                desc: "关注操作"
            }).then(function() {
                console.log(e), e.setData({
                    "navigation.isfocus": !n
                }), e.triggerEvent("site:focus", {
                    status: o
                });
            }), i.setData({
                "sidebar.isfocus": !n
            });
        },
        noaction: function() {}
    }
});